|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectga.core.selection.TournamentSelector<T>
T - The generic type of individuals.public class TournamentSelector<T extends IIndividual<T>>
Implementation of a tournament selector. This will take a n random
individuals and only the best of these n individuals will be
selected.
n is the tournament size.
| Field Summary | |
|---|---|
private boolean |
allowDuplicates
|
private boolean |
replaceOldOnInsert
|
private static int |
SELECTED_INDIVIDUALS
|
private int |
tournamentSize
|
| Constructor Summary | |
|---|---|
TournamentSelector(int tournamentSize)
Create a new tournament selector with the given tournament size. |
|
| Method Summary | |
|---|---|
int |
getTournamentSize()
Getter for the tournament size. |
void |
insert(IndividualList<T> list,
IPopulation<T> population,
boolean useEliteStrategy)
Inserts individuals into the population. |
IndividualList<T> |
select(IPopulation<T> population)
Selects individuals from the population. |
void |
setReplaceOldOnInsert(boolean replaceOldOnInsert)
Activate/deactivate the behavior of replacing individuals during insertion. |
void |
setTournamentSize(int tournamentSize)
Sets the tournament size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int SELECTED_INDIVIDUALS
private int tournamentSize
private boolean replaceOldOnInsert
private final boolean allowDuplicates
| Constructor Detail |
|---|
public TournamentSelector(int tournamentSize)
tournamentSize - The tournament size.| Method Detail |
|---|
public IndividualList<T> select(IPopulation<T> population)
ISelector
select in interface ISelector<T extends IIndividual<T>>population - The population to select from.
public void setReplaceOldOnInsert(boolean replaceOldOnInsert)
replaceOldOnInsert - Replace or not.public void setTournamentSize(int tournamentSize)
tournamentSize - The tournament size.public int getTournamentSize()
public void insert(IndividualList<T> list,
IPopulation<T> population,
boolean useEliteStrategy)
ISelector
insert in interface ISelector<T extends IIndividual<T>>list - The individuals to insert.population - The population to insert to.useEliteStrategy - Use the elite strategy if true. That will prevent the
elite from being replaced during insertion.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||